package tech.aister.day02;

public class StringPlusDemo {
    public static void main(String[] args) {
        tt1();
        tt2();
    }
    public static void tt1(){
        long before = System.currentTimeMillis();

        String str = "";

        for (int i=0;i<100000;i++){
            str+=i;//str = str + i;
        }

        System.out.println((System.currentTimeMillis()-before)+"ms");

    }

    public static void tt2(){
        long before = System.currentTimeMillis();

        StringBuilder builder = new StringBuilder();

        for (int i=0;i<100000;i++){
            // str+=i;//str = str + i;
            builder.append(i);
        }

        System.out.println((System.currentTimeMillis()-before)+"ms");

    }

}
